﻿<!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:sp="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.StartPage"
      xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
      xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
      mc:Ignorable="d" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="600" d:DesignWidth="800">

    <Grid.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Microsoft.VisualStudio.Shell.StartPage;component/Styles/startpageresources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Grid.Resources>

    <Grid x:Name="LayoutRoot" Style="{DynamicResource StartPage.OuterGridStyle}">

        <Grid.ColumnDefinitions>
            <!-- Left Hand Column -->
            <!-- This column is just wide enough to fit the Command Buttons and Start Page Options.
                 The Recent Project area is constrained to the width of the Commmand Buttons. -->
            <ColumnDefinition MinWidth="{Binding ElementName=commandButtonsGrid, Path=ActualWidth}" Width="3*" MaxWidth="330" />
            <!-- Gutter -->
            <ColumnDefinition Width="6"/>
            <!-- Allow main column to collapse to 0 -->
            <ColumnDefinition Width="7*" MinWidth="0"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <!-- Logo-->
            <RowDefinition Height="130" />
            <!-- Main Content Area -->
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--Logo Image -->
        <!--Note: To reference files relative to this XAML file, use syntax like the following: <Image Source="{sp:StartPageRelative myImage.png}" .../> -->
        <Image Grid.ColumnSpan="3" Source="http://udk.com/elements/img/bg-body.jpg" HorizontalAlignment="Left" VerticalAlignment="Top" Width="1600" Height="325" Grid.RowSpan="2" Stretch="Fill" />
        <Image Grid.ColumnSpan="3" Source="http://udk.com/elements/img/logo-udk.gif" HorizontalAlignment="Left" VerticalAlignment="Top" Width="1600" Grid.RowSpan="2" Stretch="None" Panel.ZIndex="1" Margin="50,6,0,0" />

        <!--Left Column-->
        <Grid Width="Auto" Grid.Column="0" Grid.Row="1" Margin="15,-35,0,15" VerticalAlignment="Stretch">
            <Grid.RowDefinitions>
                <!-- Command Buttons for New Projects -->
                <RowDefinition Height="Auto"/>
                <!-- MRU Row -->
                <RowDefinition Height="*"/>
                <!--Gutter at bottom of page -->
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <!-- Command Buttons -->
            <Grid x:Name="commandButtonsGrid" MinWidth="270" Grid.Row="0" Margin="0,15,0,30" HorizontalAlignment="Left">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="3"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="3"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <vs:ImageButton 
                    x:Uid="ConnectToTSButton"
                    Margin="15,2,15,2"
                    Width="Auto" 
                    Content="Connect To Team Foundation Server"
                    Visibility="{Binding Path=TeamFoundationClientSupported, Converter={StaticResource boolToVisibilityConverter}}"	
                    Style="{DynamicResource StartPage.ProjectCommand.ButtonStyle}"
                    Command="{x:Static sp:VSCommands.ExecuteCommand}" CommandParameter="Team.ConnecttoTeamFoundationServer"
                    ImageNormal="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/ConnectToTFS.png"
                    ImageHover="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/ConnectToTFSMouseOver.png"
                    ImagePressed="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/ConnectToTFSMouseDown.png">
                </vs:ImageButton>

                <vs:ImageButton
                    Grid.Row="2"
                    x:Uid="NewProjectButton"
                    Margin="15,2,0,2"
                    Width="Auto" 
                    Content="New File..."
                    Style="{DynamicResource StartPage.ProjectCommand.ButtonStyle}"
                    Command="{x:Static sp:VSCommands.ExecuteCommand}" CommandParameter="Project.AddNewItem"
                    ImageNormal="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/NewProject.png"
                    ImageHover="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/NewProjectMouseOver.png"
                    ImagePressed="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/NewProjectMouseDown.png">
                </vs:ImageButton>

                <vs:ImageButton
                    Grid.Row="4"
                    x:Uid="OpenProjectButton"
                    Margin="15,2,0,2"
                    Width="Auto"        
                    Content="Add Existing File..."
                    Style="{DynamicResource StartPage.ProjectCommand.ButtonStyle}"
                    Command="{x:Static sp:VSCommands.ExecuteCommand}" CommandParameter="Project.AddExistingItem"
                    ImageNormal="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/OpenProject.png"
                    ImageHover="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/OpenProjectMouseOver.png"
                    ImagePressed="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/OpenProjectMouseDown.png">
                </vs:ImageButton>

            </Grid>


            <!-- Reserved section Section -->
            <Grid Grid.Row="1" HorizontalAlignment="Left" Width="Auto">
                <Grid.RowDefinitions>
                    <!-- Heading -->
                    <RowDefinition Height="Auto" />
                    <!-- MRU Container -->
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <!-- Recent Projects Heading-->
                <StackPanel Grid.Row="0" Margin="0,0,0,10" Orientation="Horizontal">
                    <Path VerticalAlignment="Center" Margin="6,0,0,-4" Width="Auto" Height="1" Stretch="Fill" StrokeThickness="1" StrokeLineJoin="Round" Stroke="{DynamicResource {x:Static vsfx:VsBrushes.StartPageSeparatorKey}}" Data="F1 M 0.5,0.5L 199.5,0.5"/>
                </StackPanel>

                <StackPanel Grid.Row="1" Margin="0,0,0,10" Orientation="Horizontal">

                    <Button Margin="0,0,20,1" Style="{DynamicResource StartPage.RSS.TitleTextStyle}" Command="{x:Static sp:VSCommands.Browse}" CommandParameter="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=MGUCHCSX5TJBJ&amp;lc=GB&amp;item_name=UDK%20Development%20Kit%20Addons%20Development&amp;currency_code=USD&amp;bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest" Content="You can support future development by donating!" AutomationProperties.Name="You can support future development by donating!" VerticalAlignment="Center"/>

                </StackPanel>

            </Grid>

            <!-- Start Page Options -->
            <StackPanel Margin="0,5,0,0" Grid.Column="0" Grid.Row="2">
                <CheckBox x:Uid="AutoClose_Option" Content="Close page after project load" IsChecked="{Binding ClosePageOnOpenProject, Mode=TwoWay}" Margin="0,0,2,0"/>
                <CheckBox x:Uid="ShowOnStartUp_Option" Content="Show page on startup" IsChecked="{Binding ShowPageAtStartup, Mode=TwoWay}" Margin="0,2,0,0"/>
            </StackPanel>
        </Grid>

        <!--Center Content-->
        <Grid Grid.Column="2" Grid.Row="1" Margin="0,-35,15,15">
            <TabControl Style="{DynamicResource StartPage.TabControlStyle}" SelectedIndex="{Binding SelectedTabItemIndex, Mode=TwoWay}">

                <!-- Get Started Content Area 
                The purpose of this content area is to highlight some of the useful places where users can get help/information/resources for their projects-->
                <TabItem Header="Latest News" Style="{DynamicResource StartPage.TabItemStyle}" x:Uid="RSSFeed_Tab">
                    <Grid Margin="12,12,0,6" VerticalAlignment="Stretch" >
                        <Grid.RowDefinitions>
                            <!--Heading-->
                            <RowDefinition Height="Auto" />
                            <!-- Main Content Area -->
                            <RowDefinition Height="0.65*" />
                        </Grid.RowDefinitions>

                        <!-- Heading -->
                        <Grid Grid.Row="0" Margin="0,0,0,6" Grid.RowSpan="1" HorizontalAlignment="Stretch" Grid.ColumnSpan="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" x:Uid="RssFeed" Text="RSS feed:" Style="{DynamicResource StartPage.HeadingTextStyle}" Margin="2,0,10,3"/>
                            <TextBox Grid.Column="1" x:Name="RSS_TextField_Source" Text="{Binding Rss.RssFeed, Mode=OneWay}" Margin="0,0,2,0"/>
                            <vs:ImageButton Grid.Column="2" Margin="0,0,2,0"
                                Focusable="True"
                                Command="{x:Static sp:RssCommands.SetUrl}" CommandParameter="{Binding Text, ElementName=RSS_TextField_Source}"
                                ImageNormal="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/RSSButton.png"
                                ImageHover="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/RSSButtonMouseOver.png"
                                ImagePressed="pack://application:,,,/Microsoft.VisualStudio.Shell.StartPage;component/Images/StartPage/RSSButtonMouseDown.png">
                            </vs:ImageButton>
                        </Grid>

                        <ContentControl Grid.Row="1" Content="{Binding}" KeyboardNavigation.IsTabStop="False" >
                            <ContentControl.ContentTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <ItemsControl x:Name="Displaying" DataContext="{Binding Rss.Content, Converter={StaticResource StringToXmlDataProviderConverter}}" ItemsSource="{Binding XPath=/rss/channel/item}" Background="Transparent" KeyboardNavigation.IsTabStop="False" >
                                            <ItemsControl.Template>
                                                <ControlTemplate TargetType="ItemsControl" >
                                                    <ScrollViewer x:Name="RSSItems_ScrollViewer" CanContentScroll="True" Margin="3,4,0,0" VerticalScrollBarVisibility="Auto" VerticalAlignment="Stretch" Style="{DynamicResource StartPage.ScrollViewerStyle}" >
                                                        <ItemsPresenter/>
                                                    </ScrollViewer>
                                                </ControlTemplate>
                                            </ItemsControl.Template>
                                            <ItemsControl.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <VirtualizingStackPanel/>
                                                </ItemsPanelTemplate>
                                            </ItemsControl.ItemsPanel>
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <Grid Height="Auto" Width="Auto" Margin="0,0,20,19">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="Auto"/>
                                                            <ColumnDefinition/>
                                                        </Grid.ColumnDefinitions>
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition/>
                                                            <RowDefinition/>
                                                        </Grid.RowDefinitions>
                                                        <Button Margin="0,0,20,1" Style="{DynamicResource StartPage.RSS.TitleTextStyle}" Command="{x:Static sp:VSCommands.Browse}" CommandParameter="{Binding XPath=link}" Content="{Binding XPath=title}" AutomationProperties.Name="{Binding XPath=title}" VerticalAlignment="Center"/>
                                                        <TextBlock Margin="3,0,8,1" Grid.Column="1" Text="{Binding XPath=pubDate}"  Style="{DynamicResource StartPage.RSS.DateTextStyle}" HorizontalAlignment="Right" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" Padding="0,5,0,4"/>
                                                        <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Style="{DynamicResource StartPage.NormalTextStyle}" Margin="0,-1,0,0" Text="{Binding XPath=description, Converter={StaticResource StringToStringWithoutHypertextTagsConverter}}" TextTrimming="CharacterEllipsis" MaxHeight="50" />
                                                    </Grid>
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                        <Grid>
                                            <StackPanel x:Name="OptIn">
                                                <TextBlock x:Name="OptIn_Text" x:Uid="Rss_OptIn_Text" Style="{DynamicResource StartPage.NormalTextStyle}" Margin="3">
                                                    Click the button to subscribe to an RSS feed that provides updated information about Microsoft products and technologies. To view the Microsoft privacy policy, on the Help menu, click Online Privacy Statement.
                                                </TextBlock>
                                                <Button x:Name="OptIn_Button" x:Uid="Rss_OptIn_Button" Content="Enable RSS Feed" Command="{x:Static sp:RssCommands.EnableDownload}" HorizontalAlignment="Left" Margin="0,6,0,0" />
                                            </StackPanel>

                                            <TextBlock x:Name="Loading" x:Uid="Rss_Loading" Style="{DynamicResource StartPage.NormalTextStyle}" Margin="3">
                                                Updating the news channel...
                                            </TextBlock>

                                            <StackPanel x:Name="Prompt">
                                                <TextBlock x:Name="Prompt_Text" x:Uid="Rss_Prompt_Text" Style="{DynamicResource StartPage.NormalTextStyle}" Margin="3">
                                                    Please enter your login credentials to enable this RSS feed.
                                                </TextBlock>
                                                <Button x:Name="Prompt_Button" x:Uid="Rss_Prompt_Button" Content="Enter Credentials" Command="{x:Static sp:RssCommands.PromptForCredentials}" HorizontalAlignment="Left" Margin="0,6,0,0" />
                                            </StackPanel>

                                            <TextBlock x:Name="Error" x:Uid="Rss_Error" Style="{DynamicResource StartPage.NormalTextStyle}" Margin="3">
                                                The current news channel might not be a valid RSS feed, or your internet connection might be unavailable.
                                            </TextBlock>
                                        </Grid>
                                    </Grid>
                                    <DataTemplate.Triggers>
                                        <!-- Changing disabled state from "Hidden" to "Collapsed" to work around DevDiv 517937.
                                         This assumes that all the overlapped controls in the outer Grid are the same size.
                                         Currently they are all TextBlocks but beware of resizing issues if this changes-->
                                        <DataTrigger Binding="{Binding Path=Rss.Status}" Value="DownloadDisabled">
                                            <Setter TargetName="OptIn"       Property="Visibility" Value="Visible" />
                                            <Setter TargetName="Loading"     Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Displaying"  Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Prompt"      Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Error"       Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>

                                        <DataTrigger Binding="{Binding Path=Rss.Status}" Value="Loading">
                                            <Setter TargetName="OptIn"       Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Loading"     Property="Visibility" Value="Visible" />
                                            <Setter TargetName="Displaying"  Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Prompt"      Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Error"       Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>

                                        <DataTrigger Binding="{Binding Path=Rss.Status}" Value="Displaying">
                                            <Setter TargetName="OptIn"       Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Loading"     Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Displaying"  Property="Visibility" Value="Visible" />
                                            <Setter TargetName="Prompt"      Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Error"       Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>

                                        <DataTrigger Binding="{Binding Path=Rss.Status}" Value="PromptForCredentials">
                                            <Setter TargetName="OptIn"       Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Loading"     Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Displaying"  Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Prompt"      Property="Visibility" Value="Visible" />
                                            <Setter TargetName="Error"       Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>

                                        <DataTrigger Binding="{Binding Path=Rss.Status}" Value="Error">
                                            <Setter TargetName="OptIn"       Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Loading"     Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Displaying"  Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Prompt"      Property="Visibility" Value="Collapsed" />
                                            <Setter TargetName="Error"       Property="Visibility" Value="Visible" />
                                        </DataTrigger>
                                    </DataTemplate.Triggers>
                                </DataTemplate>
                            </ContentControl.ContentTemplate>
                        </ContentControl>
                    </Grid>
                </TabItem>
            </TabControl>
        </Grid>
    </Grid>
</Grid>
